# -*- coding: utf-8 -*-

from genpy.TestThrift.Interface import TestService
import TestsService

from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from thrift.server import TServer
    
port = 8086
handler = TestsService()
processor = TestService.Processor(handler)
transport = TSocket.TServerSocket('127.0.0.1',port)
tfactory = TTransport.TBufferedTransportFactory()
pfactory = TBinaryProtocol.TBinaryProtocolFactory()

server = TServer.TSimpleServer(processor, transport, tfactory, pfactory)

print (u"Python Server listening {0} port".format(port))
server.serve()
print (u"退出!")

